package my.jwds.p504;

public class CheckPerfectNumber {

    public static void main(String[] args) {
        CheckPerfectNumber obj = new CheckPerfectNumber();
        System.out.println(obj.checkPerfectNumber(28));
    }


    public boolean checkPerfectNumber(int num) {
        if (num == 1)return false;
        int res =0;
        for (int j = 1; j*j <= num; j++) {
            if (num%j == 0){
                res += j + num / j;
            }
        }
        return res-num == num;
    }

}